from flask import Flask, render_template, make_response, redirect

app = Flask(__name__)
app.debug = True


@app.before_first_request
def before_first_request():
    print('before_first_request')


@app.before_request
def before_request():
    print('before_requesr')


@app.teardown_request
def teardown_request(error):
    print(error)


@app.after_request
def after_request(response):
    print('after_request')
    return response


@app.route("/")
def p(name="hello"):
    return render_template("index.html")


@app.route('/a')
def index():
    response = make_response('<h1>make_response</h1>', 666)
    return response


@app.route("/s")
def l():
    return render_template("dog.html")

@app.route("/chem")
def chem():
    return redirect("https://opollopo.github.io/chemistry/")


if __name__ == '__main__':
    print(app.url_map)
    app.run(host='0.0.0.0', port=5000)
